package com.software.fanfan.dao;

import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.springframework.stereotype.Repository;

/**
 * 公共的dao
 *
 * Created by shiyanfei on 2018-01-09.
 */
@Repository
public abstract class BaseDao {

    private SessionFactory sessionFactory;

    private Session getCurrentSession(){
        return sessionFactory.getCurrentSession();
    }

    protected String create(Object o){
        return getCurrentSession().save(o).toString();
    }
}
